package cn.samler.diandi.api.controller;

import cn.samler.diandi.api.model.io.Response;
import cn.samler.diandi.api.service.UserRankService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("rank")
@Slf4j
public class UserRankController {
    private final UserRankService userRankService;

    public UserRankController(UserRankService userRankService) {
        this.userRankService = userRankService;
    }

    /**
     * 获取用户评分均值
     *
     * @param uid user id
     * @return Response
     */
    @GetMapping("detail/{uid}")
    public Response detail(@PathVariable("uid") Integer uid) {
        return userRankService.getRankByUserId(uid);
    }

}
